package com.zzx.threekingdom.judge;

import com.zzx.threekingdom.judge.Judge.IAskYesNo;
import com.zzx.threekingdom.model.AbsPlayerModel;
import com.zzx.threekingdom.model.ActionInfo;

public class AllPeach extends AskAll
{
	
	public void beginAsk(ActionInfo act, Runnable doneR)
	{
		actionInfo.clear();
		actionInfo.setCard(act.getCard());
		actionInfo.setActionName(act.getActionName());
		beginAsk(Judge.judge.getLivePmFromeCurrentTurn(), doneR);
	}

	@Override
	public void doAsk(final AbsPlayerModel pm, Runnable doneR)
	{
		if(pm.isFullHealth()==false)
		{
			IAskYesNo iAskYesNo = new IAskYesNo() { public void onResult(boolean yes) {
				if(yes == false)
				{
					int health = pm.getHealth() + 1;
					pm.setHealth(Math.max(health, pm.getHealthMax()));
				}
				goOnAsk();
			}};

			new AskImpeccable().beginAsk(null, actionInfo.getActionName(), pm, iAskYesNo);
		}
		else
			goOnAsk();
	}
	
}
